home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacApp / MacApp CD Release / MacApp 2.0.1 (Many Libraries) / Interfaces / CIncludes / UBusyCursor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-25  |  3.4 KB  |  78 lines  |  [TEXT/MPS ]

  1. /*[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]*/
  2. /* UBusyCursor.p */
  3. /* Copyright © 1985-1990 Apple Computer, Inc.    All rights reserved. */
  4. /*[f-]*/
  5. /*
  6.             T H E O R Y   O F    O P E R A T I O N
  7. The UBusyCursor unit implements a mechanism for automatically setting
  8. the cursor to the watch when the application is "busy."
  9. An application is considered "busy" if it hasn't called GetNextEvent
  10. or EventAvail for a given number of ticks, where 60 ticks equals one
  11. second.  The default time is defined by kWatchDelay, which is 120 ticks
  12. or 2 seconds--it can be changed by calling BusyDelay.   After this period
  13. of time has elapsed with no call to GetNextEvent or EventAvail, the
  14. cursor is changed to the watch.  On the next call to GetNextEvent or
  15. EventAvail, the cursor is restored to its state before it was changed to
  16. the watch.
  17. Changing the cursor to the watch is done by the VBL task AWatchTask.
  18. AWatchTask's execution frequency is set to kWatchDelay, or by calling
  19. BusyDelay.  When AWatchTask is executed it sets the cursor to the
  20. watch and resets AWatchTask's vblCount.
  21. The traps InitCursor, SetCursor and SetCCursor are patched so that
  22. they "remember" the cursor being set before executing the trap.  This
  23. will allow us to restore the cursor after it has been changed to the
  24. busy watch.
  25. The EventAvail and GetNextEvent traps are patched such that, before
  26. executing the trap, AWatchTask's vblCount is reset, and if the busy
  27. cursor is displayed, then the cursor is restored to the last cursor
  28. set by SetCursor or SetCCursor.
  29. */
  30. /*[f+]*/
  31. #ifndef  __UBusyCursor__
  32. #define __UBusyCursor__  0
  33. #endif
  34. #if  ! __UBusyCursor__
  35. #define __UBusyCursor__  1
  36.  
  37.         /* • Auto-Include the requirements for this unit's interface. */
  38. #ifndef  __TYPES__
  39. #include "Types.h"
  40. #endif
  41.  
  42. const short kWatchDelay            = 2 * 60;                /*default # of 1/60 sec. ticks before cursor
  43.                                                          changes to a watch*/
  44.  
  45. extern pascal void InitUBusyCursor(void);
  46.         /* Initialize the unit. */
  47.  
  48. extern pascal void BusyActivate(Boolean entering);
  49.         /* Call BusyActivate if you want to activate or deactivate the busy cursor mechanism. Th
  50.            is is
  51.         call by MacApp when losing/gaining control to a desk accessory or switcher partition. */
  52.  
  53. extern pascal void BusyDelay(short newDelay);
  54.         /* Call BusyDelay if you want to change the busy cursor delay. newDelay should be in 1/60
  55.         seconds; a value <= 0 means don't change the cursor. (BusyDelay respects the state flags
  56.         in the cursor info record (ie., changeToWatch and inControl.) */
  57.  
  58. extern pascal void ForceBusy(void);
  59.         /* Puts up the watch immediately */
  60.  
  61. extern pascal void ResetBusyCursor(void);
  62.         /* Call ResetBusyCursor if you want to change the cursor back to an arrow and reset the time
  63.         before changing back to a watch. This is not usually called directly by the application.
  64.         Instead, it is called each time GetNextEvent and EventAvail is called, by patches installed
  65.         by BusyInstall. */
  66.  
  67. extern pascal void BusyInstall(void);
  68.         /* BusyInstall installs the busy cursor mechanism. Typically this is called once during
  69.         program initialization. It installs the VBL task and patches the traps GetNextEvent,
  70.  
  71.         EventAvail, InitCursor, SetCursor and SetCCursor. */
  72.  
  73. extern pascal void BusyRemove(void);
  74.         /* BusyRemove uninstalls the busy cursor mechanism. Typically this is called once during
  75.         program termination. It removes the VBL task and unpatches the patched traps. */
  76. #endif
  77.  
  78.